package cn.edu.ncepu;

/**
 * 求根号2
 * 2025-11-11
 *
 * @author 醒过来摸鱼
 */
public class Main {

    public static void main(String[] args) {
        double x = 1;
        double nextX = 0;
        while (x != nextX) {
            x = nextX;
            nextX = 1/(2+x);
        }
        x = 1+x;
        System.out.println(x);
        System.out.println(x==Math.sqrt(2d));
    }
}